﻿//name:worker_A.cpp
//who: by Jack Chen
//what: just make a logic for worker_A

#include <worker_A.h>

void workerA::trigger__asking_questions() // a trigger
{	
	string input;
	std::cin >> input;
	if(input == "ask worker about cloak")
	{
	nowwhat();
	}
		
}

/* if possible, write this part to a mf as well, something like this:
   (ie., all the "routines" should be encapsulated in the mf and shouldn't be exposed)
   of course getReveived(Item* item) should be defined in .h as well
*/

//workerA::getReceived(Item* item)
//{
//    switch(item)
//    {
//        case "caddice":
//            ....;
//            break;
//        case "coin":
//            ....;
//            break;
//    }
//}

workerA::getRecied(Item* item)
{
	switch(item)
	{
		case "(caddice"):
			counting_raw();
			break;
		case "(coin");
			couting_money();
			break;
	}
			
}


if(player_input == "take cloak") // a trigger
{
	timer();
}

void workerA::nowwhat() // checks how many steps the player have been done and report msg as appropriately 
{
	switch(steps)
	{
		case 0:
			write("你需要偽裝成乞丐的服裝阿, 沒問題 只要你準備xx捲羊毛紗, 我就可以幫你裁縫");  //第一次問npc問提(ask worker about cloak)
			steps = 1;
			break;
		case 1:
			write("還缺少xx數量的羊毛紗"); //如果羊毛沙不夠的敘述
			break;
		case 2:
			write("那麼點錢怎麼算都划不來耶..");//如果錢不夠的敘述
			break;
		case 3:
			write("別炒我 我正在趕工 晚點再來");//工人還再工作時 玩家跟他要東西的敘述
			break;
		case 4:
			write("我做的乞丐服裝還不錯吧? 哈哈哈~");//如果玩家已經結束這任務的敘述
			break;
		default:
			write("逼逼逼~有bug 請馬上回報給大神 謝謝!")//這邊...不用管他...
	}
			
}


void void workerA::counting_raw() // a function for counting how many raws are reuired to make a cloak
{
	required += raw;
	if(required >= 200)
	{
		write("有了這些材料就沒問題了,不過我總也是要收點手工費吧"); //玩家給足夠的羊毛沙後 npc像玩家要錢的敘述
		steps = 2
	} else
	{
		write("還缺少xx數量的羊毛紗");//還缺少羊毛沙的敘述
	}
}



void workerA::counting_money() // counting money 
{
	required += money;
	if(required >= 1000000)
	{
		write("不錯!我馬上開工, 請等我30分鐘後再來.")//條件都滿足了 開始工作的敘述
		steps = 3;
		timer(timing=start);//start of timing 
	} else
	{
		write("這麼點錢怎麼夠呢...要我開工? 請讓我再考慮一下") //錢不夠時的敘述
	}
}
	
	
void workerA::timer()
{
	if(stpes == 3)
	{
		if(time<=30min)
		{
			write("別炒我 我正在趕工 晚點再來"); //正在工作的敘述
		}
		if(timer>30min)
		{
			write("拿去吧 這件衣服應該能讓你順利的再乞丐村行走"); //做好了 把衣服給玩家的敘述
			steps=4;
		}
	}
}
	
	
	
	
	
	
	
	
	
	
	
	
	
	